UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mb/0sa6jutPixOcoLSpaQR/ZmsUbCPvHrkAGZOrx4o8=' 
WHERE 
  key_id = '41d18e4a32f8200f576db405cf63d54fc1570f420819b049fb263066daa11d78' 
  AND (
    token = 'Mb/0sa6jutPixOcoLSpaQR/ZmsUbCPvHrkAGZOrx4o8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036