UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n7lnVAbWq+wxT3eCt1okImvsjIjtgj+WkNvcI4ARScY='
WHERE
key_id = 'bdbfbff70164a15755eddf1da18cf777e6bd2a441f89bea7e1fabb769766a294'
AND (
token = 'n7lnVAbWq+wxT3eCt1okImvsjIjtgj+WkNvcI4ARScY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)