UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q+dP1p5CEDY2EgVJVWvi+1I2ksblRmfDOidn2bEDhaM='
WHERE
key_id = '4e94ead793e19e1595bd9194a6c800c967cb144e2cd4e91fd625d16977184f1a'
AND (
token = 'q+dP1p5CEDY2EgVJVWvi+1I2ksblRmfDOidn2bEDhaM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)