UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'APvx4hoCM3Hl61B5O8w37QwoC3R+RRRLvSOZEwIGt1Q='
WHERE
key_id = '06b74132fe45a8dd4dd19a78f0a267ab55a004e84709502d54df83d89aeee8ec'
AND (
token = 'APvx4hoCM3Hl61B5O8w37QwoC3R+RRRLvSOZEwIGt1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)