UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y0Ip3Xu+34iRs+felxWe1XzZ3MiFyeAkSmgxBBXz5Gk='
WHERE
key_id = '9a0a8d12fc23172a6f8b16c5f27c28a67494405290f6ee5b993b77f01cd22f16'
AND (
token = 'Y0Ip3Xu+34iRs+felxWe1XzZ3MiFyeAkSmgxBBXz5Gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)