UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EjM4ef9pLIV1AlMl0a4s5mdFqoIphglByVzgc5LbXI0='
WHERE
key_id = '8fec46ffbbbfabd7c1a4e94507223b1a0cfa9ab1f0c8017cdd81170e4408a3b7'
AND (
token = 'EjM4ef9pLIV1AlMl0a4s5mdFqoIphglByVzgc5LbXI0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)