UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uxu1IW0tcUk+gFd8+4S7mrgzPdTU2bWWIg3xqyReRx8=' 
WHERE 
  key_id = '81838b1cb79872d2ce3ba3d0c618595a36f5b0ee556d7b8f55acf552ef5feedb' 
  AND (
    token = 'Uxu1IW0tcUk+gFd8+4S7mrgzPdTU2bWWIg3xqyReRx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022