UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MxV7eTanka9qIoOr534ku/Unbk3NrOO2HH4eH+HiEYs=' 
WHERE 
  key_id = '477e4905363fb9daab34950694deafcbf22179bd4c42d8b3b386cf6fd307ef42' 
  AND (
    token = 'MxV7eTanka9qIoOr534ku/Unbk3NrOO2HH4eH+HiEYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028