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