UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hAOBblm5jAu5H0RxSRqFTelnpGnC6bH0j2+jQFgHfoo='
WHERE
key_id = 'db6f0dbedfa57b6924f80e8fd8144e0339cab22bb87d19f899dff9c8a3ded143'
AND (
token = 'hAOBblm5jAu5H0RxSRqFTelnpGnC6bH0j2+jQFgHfoo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)