UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2JNHDbaKl9zFR9+9yBX/XA1ANorkOs6xRAxioBq6Lt8=' 
WHERE 
  key_id = '3ed695d367b06879e81e4ca77095a37fd0647a43250e705a8084adb16e11a9e9' 
  AND (
    token = '2JNHDbaKl9zFR9+9yBX/XA1ANorkOs6xRAxioBq6Lt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022