UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b14FkS0ogGkL7Ngl3Zeqed0kTB6dhex1/Lpqem/JwYc=' 
WHERE 
  key_id = '27bb9b68b10958e9e1659168dd79baf60464dce4236d7f811ecc8008c1229740' 
  AND (
    token = 'b14FkS0ogGkL7Ngl3Zeqed0kTB6dhex1/Lpqem/JwYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034