UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pKqnuhwgviChUqyoawsacRK0wFBC9YFtzRk/iBldeCE='
WHERE
key_id = 'f4f13dfd0ca2d91bdc6815410db3f1ac93a4251f3ca6e5baa8c86745c3d8346a'
AND (
token = 'pKqnuhwgviChUqyoawsacRK0wFBC9YFtzRk/iBldeCE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)