UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Vxa1Hi1IvnliUExPMrMkAV+2d8S3et603pSsq66YgYk='
WHERE
key_id = '1ae2f1308a9d82035257f2f98dfa10193859daf2a3cc7edacf2647f88f7eea37'
AND (
token = 'Vxa1Hi1IvnliUExPMrMkAV+2d8S3et603pSsq66YgYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)