UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G0nnqAzsKfmRRThkXXjB5c93wOdaGpJQBLsvPS9R39Q=' 
WHERE 
  key_id = '9919009e0c367db3064605f48a9804ac1a39a5d221433a0ae7e71ea5a53e7663' 
  AND (
    token = 'G0nnqAzsKfmRRThkXXjB5c93wOdaGpJQBLsvPS9R39Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050