UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZQb7gskSmXSZUUJv69Oru7d9pIVBvIRRnXakceu55Jk='
WHERE
key_id = 'a377c0da48d9a2bfd4f751fa36a85bf3540712c798743ece0c801c5932ff2e45'
AND (
token = 'ZQb7gskSmXSZUUJv69Oru7d9pIVBvIRRnXakceu55Jk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)