UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UCIxoY/+0HXBsNMOA7c7tD+VripACLDJK44pFDOC6Zo='
WHERE
key_id = '8d69895198dc57a99546799ccdd2e06afd0e84f3d3fbe2d72e7f2282de4bc3e2'
AND (
token = 'UCIxoY/+0HXBsNMOA7c7tD+VripACLDJK44pFDOC6Zo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)