UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SlDX/x1jipOzCh7NAY2RVaPUqA7I2WIewb3wtSnTLAY=' 
WHERE 
  key_id = '2eece0b56cbb041631e0cbe67d1ece39038fa082a4a87571a048dcfaac62d867' 
  AND (
    token = 'SlDX/x1jipOzCh7NAY2RVaPUqA7I2WIewb3wtSnTLAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058