UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q89mHbFoA+wS0KIkJUiE5sAaTo359DjCXw8k6S1+p9Q='
WHERE
key_id = '6f5bc749bd439bbd615b2ba8d550a80c7288bcb6e5948a1837b1542e3883b0e7'
AND (
token = 'q89mHbFoA+wS0KIkJUiE5sAaTo359DjCXw8k6S1+p9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)