UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6g5+kgRpmYIgTg7pl4UhTChbEPKiZAraioNHE1he6Rs=' 
WHERE 
  key_id = 'f9f5b4a5f4431b9577e61223356fdab45d3131abdc733e024ce310e43b28ed67' 
  AND (
    token = '6g5+kgRpmYIgTg7pl4UhTChbEPKiZAraioNHE1he6Rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026