UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Mr2XYhgnzfobRYxpvwprJDn4x5HcSWVZcY+4OgJKxyI='
WHERE
key_id = '3ebf1d7b55f0268207bc4b1504ff85161e4e7c65dc37038087dfb5c6ef547bb0'
AND (
token = 'Mr2XYhgnzfobRYxpvwprJDn4x5HcSWVZcY+4OgJKxyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)