UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vfemCWbiVYCVr8WeuEv/52w2iE4jyPW8ztkGONKWXQg='
WHERE
key_id = 'bf4f359a2907dd48498510f1b137c5b9fe11ee90b7c042173e078862e2d4f37c'
AND (
token = 'vfemCWbiVYCVr8WeuEv/52w2iE4jyPW8ztkGONKWXQg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)