UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r87AtDL/IMq0EX7uHp4wbTmWWnQrq9hmLooXpaLIKWs='
WHERE
key_id = 'e871236f1e287e5668243adf1695a412b417023de2b35255c096b55e14ebd5d7'
AND (
token = 'r87AtDL/IMq0EX7uHp4wbTmWWnQrq9hmLooXpaLIKWs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)