UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hZ0dkmX/cNqiJvXFACV0LCIKDw5tWSW2pWTUPDu6sts='
WHERE
key_id = '5154945b8c2daa7905459bfaab38e73df66f38bfdbb7f00418957f66c3bc72d5'
AND (
token = 'hZ0dkmX/cNqiJvXFACV0LCIKDw5tWSW2pWTUPDu6sts='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)