UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A9foNoR3p1xao+3yR2aoLU3T1mAChVN7cKGJytBn6Z8='
WHERE
key_id = 'd358ef90bc05a4eed7c9a5ef0377ffc085bc250f110320a71846cf5248d6b231'
AND (
token = 'A9foNoR3p1xao+3yR2aoLU3T1mAChVN7cKGJytBn6Z8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)