UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YvqbqddgNEWnzKDctoZrqNnYrMhzDdDSZwI+6tOI34o='
WHERE
key_id = 'dcbf246b0bb91294ed879a43a8b39b3b92075ab46172f4f2437abfc4b2c4008c'
AND (
token = 'YvqbqddgNEWnzKDctoZrqNnYrMhzDdDSZwI+6tOI34o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)