UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cIxYvR+Bv0lX3zawqziHtgp1WIiptcIzXA8SSPuMmB8='
WHERE
key_id = 'b4bc1eb3e9d48228f9e35ff7d083de91a3fd58b83159363867967275f46804ca'
AND (
token = 'cIxYvR+Bv0lX3zawqziHtgp1WIiptcIzXA8SSPuMmB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)