UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '34+eGL0+D3iM8ShT7xM59VI7aSLxvq7bjOOjXx/Xlig='
WHERE
key_id = 'e065aa66b22ce16f9996de6b419f6d248b6ea300d5e7c37a6f1ba5a01e6a561d'
AND (
token = '34+eGL0+D3iM8ShT7xM59VI7aSLxvq7bjOOjXx/Xlig='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)