UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4jJKTZHKlftC4YW0KqBWH5VC2OwJBs5CmfD6pez1zAg='
WHERE
key_id = '50ddea4623f3918c97099bd33633e8cbb408cebc2826dcfe60d34cb9f03d5f9c'
AND (
token = '4jJKTZHKlftC4YW0KqBWH5VC2OwJBs5CmfD6pez1zAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)