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