UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sgDWvRySRLtx8ih7lvkqYGh6eOABf7p8ra44NtZVUIo='
WHERE
key_id = '009e2ec79299b2b40d657cd65432fe12e9390ffda2306a8d5a4a47f5b1701fa9'
AND (
token = 'sgDWvRySRLtx8ih7lvkqYGh6eOABf7p8ra44NtZVUIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)