UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I+zuLKjajnTjDaEVbibQARotDLCwTqvDowQYCrZvfUw=' 
WHERE 
  key_id = 'f85c1d54afc7caa1337fc2c14e61b2f26786f05d353d5890a29c59b7f4f9f303' 
  AND (
    token = 'I+zuLKjajnTjDaEVbibQARotDLCwTqvDowQYCrZvfUw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026