UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1wvklbtjXsYRx8X3VyW4GQLcQ3h1buWH7euLviNoeR8='
WHERE
key_id = '5051fb372b8972497140638364640f778f4c571a73bef7ef24b5d6e3331d8fa4'
AND (
token = '1wvklbtjXsYRx8X3VyW4GQLcQ3h1buWH7euLviNoeR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)