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