UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Od4qFMUzMCTDlMQeVOe5EjOSY1v4fNxjtLINMKUpo8I=' 
WHERE 
  key_id = '37b3400c079ad6fbef1476c4d615118dbf5cad39a1014a7a1d4038026efaeae8' 
  AND (
    token = 'Od4qFMUzMCTDlMQeVOe5EjOSY1v4fNxjtLINMKUpo8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027