UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'phoCbmPYGHJ16FA7R3a+CtxcIKXk0fU8B0TNZT7MAS4='
WHERE
key_id = 'a0b0aa1bd657051a9117c0ea06195d4f31c6524f8add4a59f604a28de71b2604'
AND (
token = 'phoCbmPYGHJ16FA7R3a+CtxcIKXk0fU8B0TNZT7MAS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)