UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oY9c0QgKWfLk976NzQbrFWPHdEdXP/POWOyGeZ9vwkI='
WHERE
key_id = 'f682e886f6954014508bcd297c59b0697dbb5ee132fecbcf1ff64d7c17579aad'
AND (
token = 'oY9c0QgKWfLk976NzQbrFWPHdEdXP/POWOyGeZ9vwkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)