UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rtLQTVWTNLkdpmHjZXTdHNcY2r/UQ/DLZhlhK+Xn3cs=' 
WHERE 
  key_id = '748de4d819a587f2c437bf0e69f0559d28b24718426f3bc154d4045b0b271304' 
  AND (
    token = 'rtLQTVWTNLkdpmHjZXTdHNcY2r/UQ/DLZhlhK+Xn3cs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034