UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RnknBLDmJD9ZO07BGt+MzGy1E2QS9LLuY63SYcthavs=' 
WHERE 
  key_id = '6cd6ae10a75aa2c739ba41eefe32de42661a8232e41e23f13229ee9064fce77c' 
  AND (
    token = 'RnknBLDmJD9ZO07BGt+MzGy1E2QS9LLuY63SYcthavs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039