UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9Gv/D0LrX1eIgcmkb7DGzhMQ5rdXR+TAJeNJe2Ou9g8=' 
WHERE 
  key_id = '0a1ce46886b75435d411c8254a01bc6fcd3d25d0fff2bca04332d01640b00d9c' 
  AND (
    token = '9Gv/D0LrX1eIgcmkb7DGzhMQ5rdXR+TAJeNJe2Ou9g8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035