UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pJEIDQV9mH+zdkComHGaw18Y1pG7U4KEYvEUw6+6yrY='
WHERE
key_id = 'a35c87626c0867914a151ab3f7f81f7ddffa0eaf5b9e2f8450cbfec8a3788ffb'
AND (
token = 'pJEIDQV9mH+zdkComHGaw18Y1pG7U4KEYvEUw6+6yrY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)