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