UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xtMM57ABj1i3Qeft6ildEwJhIaJs47SJjq5NL+Sh79o='
WHERE
key_id = 'f145959654769fdcf5a0b0490041618a13e86e96a9d1be834cefd13b9d3d9b36'
AND (
token = 'xtMM57ABj1i3Qeft6ildEwJhIaJs47SJjq5NL+Sh79o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)